<template>
  <div class="card-container">
    <!-- v-if="!outSea" -->
    <div class="raise-dingding-button">
      <div class="raise-dingding-desc">
        请使用钉钉客户端查看您的票务信息并激活
      </div>
      <div class="ticket-token-dialog-qrcode">
        <img v-if="qrcode" :src="qrcode" />
      </div>
      <co-button class="raise-dingding-action" color="primary" @click="gotoDingtalk">
        打开钉钉
      </co-button>
      <!-- <div class="raise-dingding-desc">
        已安装钉钉？请点此打开钉钉大会票务系统
      </div> -->
      <a class="download-dingding-action" href="https://www.dingtalk.com/download?lwfrom=2017120202092064209309201&t=1530078705019">
        下载钉钉
      </a>
      <!-- <div class="raise-dingding-desc">
        未安装钉钉? 请点此下载并安装钉钉
      </div> -->
      <!-- <div class="qr">
        <img src="https://gw.alicdn.com/tfs/TB10uRkICzqK1RjSZPxXXc4tVXa-373-372.png" alt="">
      </div>
      <div class="qr-desc">
        PC购票可扫码进入钉钉大会票务系统
      </div> -->
    </div>
    <!-- v-else -->
    <!-- <div class="out-sea-email">
      <div class="out-sea-email-inner">
        尊敬的海外用户<br>入场凭证稍后将发送到您预留的邮箱<br>请注意查收
      </div>
    </div> -->
    <ul class="description">
      <li>请务必使用购票时填写的用票人手机号码登录钉钉客户端查看入场凭证；</li>
      <li>已安装钉钉客户端的用户，点击后将在钉钉-大会组织中看到自己的入场凭证；</li>
      <li>未安装钉钉客户端的用户，需要先安装钉钉客户端，再使用购票时填写的用票人手机号码登录查看；</li>
      <li>同一账户购买多张门票时，如已填写其他用票人信息，则实际用票人将收到短信提示获取入场信息，且可按上述流程查看入场凭证；如您以团购方式购买多张门票，请登录钉钉客户端-我的门票进行团购票分发、管理。</li>
    </ul>
  </div>
</template>

<script>
import jrQrcode from "jr-qrcode";
export default {
  name: "AcquireTicket",
  props: ["outSea"],
  data() {
    return {
      qrcode: "",
      locationHref: ""
    };
  },
  computed: {},
  mounted() {
    this.qrcode = jrQrcode.getQrBase64(this.locationHref, {
      width: 356,
      height: 356
    });
  },
  created: function() {
    // this.id = this.$route.params.id;
    this.locationHref = `dingtalk://dingtalkclient/action/switchtab?index=2&name=work&scene=1&corpid=${sessionStorage.getItem(
      "corpIdUcan"
    )}`;
  },
  methods: {
    gotoDingtalk() {
      location.href = this.locationHref;
    }
  }
};
</script>

<style scoped lang="scss">
.ticket-token-dialog-qrcode {
  width: 356px;
  height: 356px;
  margin: 10px auto 16px auto;
  > img {
    width: 100%;
    height: 100%;
    display: block;
  }
}

.card-container {
  width: 100%;
  padding: 0;
  overflow: hidden;
  margin-bottom: 24px;
  text-align: left;

  .raise-dingding-button {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: 10px 0;

    .raise-dingding-action {
      width: 384px;
    }

    .download-dingding-action {
      margin-top: 18px;
      display: block;
      font-size: 36px;
      padding: 23px 120px;
      border: 1px solid #fff;
      color: #fff;
      text-decoration: none;
      border-radius: 4px; /*no*/
    }
    .raise-dingding-desc {
      margin-bottom: 11px;
    }
    .raise-dingding-desc,
    .qr-desc {
      margin-top: 18px;
      font-size: 24px;
      color: #a3a3a3;
    }

    .qr {
      margin-top: 37px;
      width: 100%;
      display: flex;
      justify-content: space-around;
      align-items: center;
      img {
        width: 200px;
        height: 200px;
      }
    }
  }

  .out-sea-email {
    width: 100%;
    padding: 2px;
    box-sizing: border-box;
    background-image: linear-gradient(-116deg, #3cb9ff 0%, #6044d4 100%);
    border-radius: 8px;

    .out-sea-email-inner {
      background: #000000;
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 100%;
      box-sizing: border-box;
      padding: 24px;
      text-align: center;
      font-size: 24px;
      color: #fff;
      line-height: 1.8;
      border-radius: 8px;
    }
  }

  .description {
    width: 100%;
    box-sizing: border-box;
    padding: 30px 0 30px 30px;
    border-top: 1px dashed #fff;
    margin-top: 30px;
    position: relative;
    font-size: 22px;

    &:before {
      content: "说明";
      position: absolute;
      top: -15px;
      left: 50%;
      margin-left: -35px;
      width: 70px;
      background: #000;
      text-align: center;
    }

    li {
      list-style: url("https://gw.alicdn.com/tfs/TB1PgL.HZbpK1RjSZFyXXX_qFXa-10-10.svg");
      line-height: 1.8;
      color: #d1d1d1;
    }
  }
}
</style>
